package com.tourism.admin.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tourism.admin.common.Result;
import com.tourism.admin.mapper.PermissionMapper;
import com.tourism.admin.model.entity.Permission;
import com.tourism.admin.model.entity.RolePermission;
import com.tourism.admin.service.PermissionService;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class PermissionServiceImpl extends ServiceImpl<PermissionMapper, Permission> implements PermissionService {
    @Override
    public List<RolePermission> getRolePermissionByRoleId(Integer roleId) {
        return this.baseMapper.getRolePermissionByRoleId(roleId);
    }

    @Override
    public Result<?> deletePermissionsByRoleId(Integer roleId) {
        return Result.success().setData(this.baseMapper.deletePermissionsByRoleId(roleId));
    }

    @Override
    public Result<?> insertRoleAndPermission(Integer roleId, Integer permissionId) {
        return Result.success().setData(this.baseMapper.insertRoleAndPermission(roleId,permissionId));
    }
}
